home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NT Sources
/
Infomagic - NT Source Volume 1 (Disc 1 of 2).iso
/
network
/
pcdctrla.exe
/
PCDCTRL.EXE
/
PCDPROT.TPU
< prev
next >
Wrap
Text File
|
1997-09-08
|
6KB
|
149 lines
!+++
! PCDUO_PROTOCOL_INI.TPU - Edit the NDIS PROTOCOL.INI file for PC-Duo
!
! v3.02 16-May-96 DB - Updated to support Windows 95 NetBEUI
!---
! We only edit one section: [NetBEUI], to increase the number of SESSIONS and
! NCBS. These changes are only done if the LANABASE=value is 0 (zero). This
! makes NetBEUI the default NetBIOS adapter for PC-Duo.
PROCEDURE PCD_update_protocol ();
! Declare some local variables - initialised to zero
LOCAL PCD_lanabase, ! The NetBEUI LANABASE= value (string)
PCD_old_ncbs, ! The current NCBS value (string)
PCD_old_sessions, ! The current SESSIONS value (string)
PCD_new_ncbs, ! The new NCBS value (integer)
PCD_new_sessions, ! The new SESSIONS value (integer)
PCD_section_name, ! Holds the name of the NetBEUI section
PCD_section_range, ! Used to detect or map file sections
PCD_wfw_version, ! Holds the [network.setup] version= value
PCD_whitespace_pattern; ! Pattern allowing leading whitespace
! Use a pattern so we get the right values
! This allows leading whitespace, but nothing else before the keyword.
PCD_whitespace_pattern := (LINE_BEGIN | (LINE_BEGIN + SPAN (" " + ASCII (9))));
! See if we are running Windows for Workgroups by picking up the version
! string from the [network.setup] section. If this section is not present,
! then this isn't a WFW PROTOCOL.INI. If the value is 0x3100, it is 3.1.
! If it is 0x3110, it is 3.11
PCD_wfw_version := LUT_win_get_value ("[network.setup]", (PCD_whitespace_pattern + "version="));
If ((PCD_wfw_version <> 0)
AND (PCD_wfw_version <> ""))
Then
MESSAGE (FAO ("Windows for Workgroups version <!AS> recognised", PCD_wfw_version));
PCD_new_ncbs := 48;
PCD_new_sessions := 16;
Else
MESSAGE ("Windows for Workgroups not recognised");
PCD_new_ncbs := 24;
PCD_new_sessions := 12;
Endif;
! Look for a [NETBEUI] (3.11) or a {MS$NETBEUI] (3.1) section
! PATHWORKS 5 also uses [NETBEUI] so we want to catch this too.
PCD_section_name := "[MS$NETBEUI]";
PCD_section_range := LUT_create_range (LINE_BEGIN + PCD_section_name, LINE_BEGIN + "[");
If (PCD_section_range = 0)
Then
PCD_section_name := "[NETBEUI]";
PCD_section_range := LUT_create_range (LINE_BEGIN + PCD_section_name, LINE_BEGIN + "[");
Endif;
! Windows 95 uses [NETBEUI$], but it is mostly configured through the
! Registry. We can't change that with LANutil.
If (PCD_section_range = 0)
Then
PCD_section_name := "[NETBEUI$]";
PCD_section_range := LUT_create_range (LINE_BEGIN + PCD_section_name, LINE_BEGIN + "[");
Endif;
! If no sections were found, then there is nothing for us to do here.
If (PCD_section_range <> 0)
Then
! Pick up the LANABASE value from this section. If it is missing,
! or set to zero, then we check the NCBS and SESSIONS values.
PCD_lanabase := LUT_win_get_value (PCD_section_name, (PCD_whitespace_pattern + "LANABASE"), PCD_section_range);
If ((PCD_lanabase = 0)
OR (PCD_lanabase = "0"))
Then
! Now, look for the SESSIONS and NCBS lines in the section. Use the
! whitespace pattern to make sure that we get the right values, and
! the optional range parameter to limit the search.
PCD_old_ncbs := LUT_win_get_value (PCD_section_name, (PCD_whitespace_pattern + "NCBS"), PCD_section_range);
PCD_old_sessions := LUT_win_get_value (PCD_section_name, (PCD_whitespace_pattern + "SESSIONS"), PCD_section_range);
! Check the NCBS value first. The correct value to use depends upon
! whether we are running Bridge, Control, and Slave on the same PC.
! We can't tell this from this file alone. Assume we are running all
! of them for now. If it is not present, empty, or less than
! PCD_new_ncbs, increase the value.
If ((PCD_old_ncbs = 0)
OR (PCD_old_ncbs = "")
OR (INT (PCD_old_ncbs) < PCD_new_ncbs))
Then
MESSAGE (FAO ("Increasing NCBS to !UL", PCD_new_ncbs));
LUT_spaceline_replace_add ("NCBS", "NCBS=" + STR (PCD_new_ncbs), PCD_section_range);
Else
MESSAGE (FAO ("Current !AS NCBS value is !AS", PCD_section_name, PCD_old_ncbs));
Endif;
! Check the SESSIONS value next. Make sure that this is at least 16,
! though the correct value to use will depend upon how many NetBIOS
! applications are running. Increase this if you have difficulty
! making connections to network resources.
If ((PCD_old_sessions = 0)
OR (PCD_old_sessions = "")
OR (INT (PCD_old_sessions) < PCD_new_sessions))
Then
MESSAGE (FAO ("Increasing SESSIONS to !UL", PCD_new_sessions));
LUT_spaceline_replace_add ("SESSIONS", "SESSIONS=" + STR (PCD_new_sessions), PCD_section_range);
Else
MESSAGE (FAO ("Current !AS SESSIONS value is !AS", PCD_section_name, PCD_old_sessions));
Endif;
Else
MESSAGE (FAO ("Skipping !AS LANABASE !AS", PCD_section_name, PCD_lanabase));
Endif;
Else
MESSAGE (FAO ("!AS section not found in PROTOCOL.INI file. Exiting.", PCD_section_name));
Quit;
Endif;
Endprocedure;
LUT_start_edit (); ! This reads the file (if it exists), creates a buffer,
! and positions us at the top of the buffer
IF LUT_buffer_empty
THEN
quit; ! Error - the input file must exist!
ENDIF;
! Do the update
PCD_update_protocol ();
! And now perform 'standard' finishing functions...
LUT_finish_edit ();